package com.zisu.wcsopcua.opcua.taskPool;


import com.zisu.wcsopcua.opcua.selfunion.Enum.PLCVar;
import com.zisu.wcsopcua.opcua.selfunion.UAService;
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.Callable;

/**
 * @Author: 蔡翔
 * @Date: 2019/10/30 16:23
 * @Version 1.0
 */
public class MultiWorkRunnable<T> implements Callable<T> {
    private final static Logger logger = LoggerFactory.getLogger(MultiWorkRunnable.class);
    private UAService uaService;
    public MultiWorkRunnable(UAService uaService){
        this.uaService = uaService;
    }
    public MultiWorkRunnable(){

    }
    public synchronized void initialMultiWorkRunnable(UAService uaService){
        this.uaService = uaService;
    }

    public static void main(String[] args) {

    }

    @Override
    public T call() throws Exception {
        Long start = System.currentTimeMillis();
        //10000/200
        for (int i = 0; i < 60; i++) {
            DataValue Byte = uaService.getValue(PLCVar.Byte, "plc2");
            DataValue Boolean = uaService.getValue(PLCVar.Boolean, "plc2");
            DataValue ByteString = uaService.getValue(PLCVar.ByteString, "plc2");
            DataValue plc11 = uaService.getValue(PLCVar.DateTime, "plc2");
            DataValue plc12 = uaService.getValue(PLCVar.Double, "plc2");
            DataValue plc13 = uaService.getValue(PLCVar.Float, "plc2");
            DataValue plc14 = uaService.getValue(PLCVar.Int16, "plc2");
            DataValue plc15 = uaService.getValue(PLCVar.Int32, "plc2");
            DataValue plc16 = uaService.getValue(PLCVar.Int64, "plc2");
            DataValue plc17 = uaService.getValue(PLCVar.Integer, "plc2");
            DataValue plc18 = uaService.getValue(PLCVar.String, "plc2");
            DataValue plc19 = uaService.getValue(PLCVar.Time, "plc2");
        }
        Long end = System.currentTimeMillis();
        Long res = end-start;
        System.out.println(res);
        return (T)res;
        //return (T(1));
    }
}
